home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.orig.lzh / expire / doexpire < prev    next >
Text File  |  1989-06-27  |  1KB  |  60 lines

  1. #! /bin/sh
  2. # doexpire - overall administration for expire
  3.  
  4. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  5. . ${NEWSCONFIG-/usr/lib/news/bin/config}
  6.  
  7. PATH=$NEWSCTL/bin:$NEWSBIN/expire:$NEWSBIN:$NEWSPATH ; export PATH
  8. umask $NEWSUMASK
  9.  
  10. lock="$NEWSCTL/LOCKexpire"
  11. ltemp="$NEWSCTL/L.$$"
  12. echo $$ >$ltemp
  13. trap "rm -f $ltemp ; exit 0" 0 1 2 15
  14. if newslock $ltemp $lock
  15. then
  16.     trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
  17. else
  18.     echo "$0: expire apparently already running" | mail "$NEWSMASTER"
  19.     exit 1
  20. fi
  21.  
  22. cd $NEWSCTL
  23.  
  24. firstctl=
  25. firstar=
  26. while true
  27. do
  28.     size="`sizeof history history.pag history.dir`"
  29.     if test " `spacefor $size control`" -le 0
  30.     then
  31.         if test " $firstctl" = " "
  32.         then
  33.             echo "$0: trouble finding space for work files" |
  34.                             mail "$NEWSMASTER"
  35.             firstctl=n
  36.         fi
  37.     elif test " `spacefor 1 archive`" -le 0
  38.     then
  39.         if test " $firstar" = " "
  40.         then
  41.             echo "$0: trouble finding space for archiving" |
  42.                             mail "$NEWSMASTER"
  43.             firstar=n
  44.         fi
  45.     else            # enough space both places
  46.         break
  47.     fi
  48.     sleep 600        # and hope it will improve
  49. done
  50.  
  51. expire $* $NEWSCTL/explist 2>/tmp/doex$$
  52. if test -s /tmp/doex$$
  53. then
  54.     (echo 'expire problems:' ; cat /tmp/doex$$ ) | mail "$NEWSMASTER"
  55.     rm -f /tmp/doex$$
  56.     exit 1
  57. fi
  58. rm -f /tmp/doex$$
  59. exit 0
  60.